import api from '../../api';
import { message } from 'antd';

export default {
  namespace: 'nonstandardReportM',
  state: {},

  effects: {
    // 获取tab下数据
    *getTableData({ payload, callback }, { call, put }) {
      const response = yield call(api.nonstandardReport.queryReportTable, payload);
      if (response && response.code == 0) {
        callback('success', response.data);
      } else {
        callback('fail');
        message.error(response?.msg || '查询失败！');
      }
    },
    // 获取现金流明细
    *getTableDetail({ payload, callback }, { call, put }) {
      const response = yield call(api.nonstandardReport.queryReportTableDetail, payload);
      if (response && response.code == 0) {
        callback('success', response.data);
      } else {
        callback('fail');
        message.error(response?.msg || '查询失败！');
      }
    },
  },

  reducers: {
    save(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },
};
